package top.cjwtx.holy.phone.controller;

import com.alibaba.druid.mock.MockArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import top.cjwtx.common.entity.R;
import top.cjwtx.holy.pojo.dto.PwdCkDTO;
import top.cjwtx.holy.service.IPwdService;

import java.util.List;

@Controller
@RequestMapping("/pwd")
public class PwdController extends BaseController{

    @Autowired
    private IPwdService pwdService;

    @GetMapping("/pwd")
    public String pwdList(Model model){
//        List<PwdCkDTO> pwdCkDTOS = pwdService.listPwdCkByUserId(getUserId());
//        model.addAttribute("pwdList",pwdCkDTOS);
        //加载密码数据
        return "holy/pwd/pwdList";
    }

    @ResponseBody
    @GetMapping("/pwdList")
    public R getPwdList(){
        List<PwdCkDTO> pwdCkDTOS = pwdService.listPwdCkByUserId(getUserId());
        return R.ok(pwdCkDTOS);
    }

}
